|
|
|
|
|
|
|
Puzzle 27
Universal Identifiers, Part 3 |
|
|
|
|
|
|
|
|
In puzzle 26, "universal identifiers, part 2," you learned how to work with the CLSID structure and how the data in this structure can be represented to the user. One representation showed the individual fields of the structure; the other showed the raw data inside the structure. You also read that GUIDs are often described in string format. |
|
|
|
|
|
|
|
|
The Win32 API includes the function StringFromCLSID, which can be used to obtain a string representation of GUID data. The function is defined in the Win32 documentation as follows: |
|
|
|
|
|
|
|
|
WINOLEAPI StringFromCLSID(
REFCLSID rclsid, //CLSID to be converted
LPOLESTR * ppsz //Indirect pointer to the resulting string on return
); |
|
|
|
|
|
|
|
|
rclsid
[in] CLSID to be converted.
ppsz
[out] Pointer to the resulting string. |
|
|
|
|
|
|
|
|
The return type is WINOLEAPI, which is defined as follows in the file objbase.h: |
|
|
|
|
|
|
|
|
The STDAPI data type is defined in file basetyps.h as follows: |
|
|
|
 |
|
|
|
|
#define STDAPI EXTERN_C HRESULT STDAPICALLTYPE |
|
|
|
|
|
|
|
|
EXTERN, C, and STDAPICALLTYPE are all C language terms that define the calling convention, a subject that will be discussed in Puzzle 29 and is unimportant for this puzzle. The HRESULT indicates that this function returns a 32-bit Long |
|
|
|
|
|